Grant Full Ownership to Your User fixed Xcode 16 compiling issues for me.
Run this command in the terminal to change the ownership of the DerivedData folder to your user:
sudo chown -R $USER ~/Library/Developer/Xcode/DerivedData
Topic:
Developer Tools & Services
SubTopic:
Xcode